﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using FlexiCommerce.Collections;
//using FlexiCommerce.Components;
//using NUnit.Framework;
//using NUnit.Framework.SyntaxHelpers;

//namespace FlexiCommerce.Tests.Collections
//{
//    [TestFixture]
//    public class CountFilterTests : FilterTestsBase
//    {
//        public ItemList<Category> CreateCategories(int numberOfItems)
//        {
//            ItemList<Category> items = new ItemList<Category>();
//            for (int i = 0; i < numberOfItems; i++)
//            {
//                items.Add(CreateOneCategory(i + 1, i.ToString(), null));
//            }
//            return items;
//        }

//        [Test]
//        public void CanFilter_TwoExessiveItems_WithStaticMethod()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            IList<Category> list = fiveItems;

//            CountFilter<Category>.Filter(list, 0, 3);
//            Assert.AreEqual(3, fiveItems.Count);

//        }

//        [Test]
//        public void CanFilter_FirstAndLastItem_WithStaticMethod()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            Category toBeFirst = fiveItems[1];
//            Category toBeLast = fiveItems[3];
//            CountFilter <Category>.Filter(fiveItems, 1, 3);
//            Assert.AreEqual(3, fiveItems.Count);
//            Assert.AreEqual(toBeFirst, fiveItems[0]);
//            Assert.AreEqual(toBeLast, fiveItems[2]);
//        }

//        [Test]
//        public void CanFilter_TwoExessiveItems_WithClassInstance()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            CountFilter<Category> filter = new CountFilter<Category>(0, 3);
//            filter.Filter(fiveItems);
//            Assert.AreEqual(3, fiveItems.Count);
//        }

//        [Test]
//        public void CanFilter_FirstAndLastItems()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            Category toBeFirst = fiveItems[1];
//            Category toBeLast = fiveItems[3];
//            CountFilter<Category> filter = new CountFilter<Category>(1, 3);
//            filter.Filter(fiveItems);
//            Assert.AreEqual(3, fiveItems.Count);
//            Assert.AreEqual(toBeFirst, fiveItems[0]);
//            Assert.AreEqual(toBeLast, fiveItems[2]);
//        }

//        [Test]
//        public void CanPipe_FirstAndLastItems()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            CountFilter<Category> filter = new CountFilter<Category>(1, 3);
//            IEnumerable<Category> collection = filter.Pipe(fiveItems);
//            IList<Category> middleItems = new List<Category>(collection);
//            Assert.AreEqual(3, middleItems.Count);
//            Assert.That(middleItems[0], Is.EqualTo(fiveItems[1]));
//            Assert.That(middleItems[2], Is.EqualTo(fiveItems[3]));
//        }

//        [Test]
//        public void CanSkipFilteringWithoutComplaining()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            CountFilter<Category> filter = new CountFilter<Category>(0, 10);
//            filter.Filter(fiveItems);
//            Assert.AreEqual(5, fiveItems.Count);
//        }

//        [Test]
//        public void CanFilterInExternalLoop()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            CountFilter<Category> filter = new CountFilter<Category>(2, 2);

//            int i = 0;
//            Assert.IsFalse(filter.Match(fiveItems[i++]));
//            Assert.IsFalse(filter.Match(fiveItems[i++]));
//            Assert.IsTrue(filter.Match(fiveItems[i++]));
//            Assert.IsTrue(filter.Match(fiveItems[i++]));
//            Assert.IsFalse(filter.Match(fiveItems[i++]));
//        }

//        [Test]
//        public void CanResetFilter()
//        {
//            ItemList<Category> fiveItems = CreateCategories(5);
//            CountFilter<Category> filter = new CountFilter<Category>(2, 2);

//            foreach (Category item in fiveItems)
//                filter.Match(item);

//            filter.Reset();
//            int i = 0;
//            Assert.IsFalse(filter.Match(fiveItems[i++]));
//            Assert.IsFalse(filter.Match(fiveItems[i++]));
//            Assert.IsTrue(filter.Match(fiveItems[i++]));
//            Assert.IsTrue(filter.Match(fiveItems[i++]));
//            Assert.IsFalse(filter.Match(fiveItems[i++]));
//        }
//    }
//}
